// 如果没有通过拦截器配置域名的话，可以在这里写上完整的URL(加上域名部分)
let hotSearchUrl = '/ebapi/store_api/hot_search';
let indexUrl = '/ebapi/public_api/index';

// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
const install = (Vue, vm) => {
	let apis = {}
	apis.checkVersionClick = (params = {}) => vm.$u.post('/api/version/check/app', params);
	apis.getUserLevel = (params = {}) => vm.$u.post('/api/user/level/xlist', params);
	apis.getUserInfo = (params = {}) => vm.$u.post('/api/user/xinfo', params);
	apis.setPassword = (params = {}) => vm.$u.post('/api/user/modify_pwd', params);
	apis.getArticleList = (params = {}) => vm.$u.post('/api/article/index/xlist', params);
	apis.getArticleInfo = (params = {}) => vm.$u.post('/api/article/index/xinfo', params);
	apis.getOrderIndex = (params = {}) => vm.$u.post('/api/order/index', params); 
	apis.getOrderList = (params = {}) => vm.$u.post('/api/order/order/xlist', params);
	apis.getPreOrderList = (params = {}) => vm.$u.post('/api/order/preorder/xlist', params);
	apis.addOrder = (params = {}) => vm.$u.post('/api/order/preorder/add', params); 
	apis.cancelPreOrder = (params = {}) => vm.$u.post('/api/order/preorder/cancel', params); 
	apis.delPreOrder = (params = {}) => vm.$u.post('/api/order/preorder/del', params); 
	apis.cancelOrder = (params = {}) => vm.$u.post('/api/order/order/cancel', params); 
	apis.delOrder = (params = {}) => vm.$u.post('/api/order/order/del', params); 
	apis.shouliOrder = (params = {}) => vm.$u.post('/api/order/order/sh3', params);
	apis.cgOrder = (params = {}) => vm.$u.post('/api/order/order/sh1', params);
	apis.sbOrder = (params = {}) => vm.$u.post('/api/order/order/sh2', params);
	apis.usernameLogin = (params = {}) => vm.$u.post('/api/login/username', params);
	apis.getSysArticleInfo = (params = {}) => vm.$u.post('/api/system/article/xinfo', params);
	
	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = {...apis};
}

export default {
	install
}